# -*- coding: utf-8 -*-
# @Time    : 2020/4/21 下午5:01
# @Author  : lilong

from typing import List, Dict, Text, Any
from rasa_sdk.executor import ActionExecutor, CollectingDispatcher
from rasa_sdk import Action, Tracker
from rasa_sdk.events import SlotSet

from rasa_sdk import Action
from rasa_sdk.events import SlotSet


class ActionTestLiLong(Action):
    def name(self) -> Text:
        return "action_check_restaurants"

    def run(self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

        # cuisine = tracker.get_slot('cuisine')
        # q = "select * from restaurants where cuisine='{0}' limit 1".format(cuisine)
        # result = db.query(q)

        result = "kk"

        return [SlotSet("matches", result if result is not None else [])]
